<h1>診断情報</h1>
<table border="1" width="400" id="order_info">
  <tr>
    <th>標識番号 </th>
    <td><%= @order.recipe_name%></td>
    <th>サイズ </th>
    <td><%= @order.car_size%></td>
  </tr>
  <tr>
    <th>車種 </th>
    <td><%= @order.car_type%></td>
    <th>塗装種類 </th>
    <td><%= @order.paint_type%></td>
  </tr>
  <tr>
  	<th>修正機</th>
	<% if @order.use_amend_set%>
		<td id="use_amend_set">使用<td>
	<%else%>
		<td id="use_amend_set">使用しない<td>
	<%end%>
  </tr>
</table>
<div id="item_title">プレーム修正機使用する？:</div>
<% form_tag(url_for_options = {:controller => :internal_damage_judge,:action => :part_selector}, options = {:id => "frame_select"})do%>
<% if @order.use_amend_set %>
	<%= radio_button_tag 'frame', true, true %>使用
	<%= radio_button_tag 'frame', false %>使用しない
<% elsif @order.use_amend_set == nil%>
	<%= radio_button_tag 'frame', true%>使用
	<%= radio_button_tag 'frame', false%>使用しない
<% else%>
	<%= radio_button_tag 'frame', true%>使用
	<%= radio_button_tag 'frame', false, true%>使用しない
<%end%>
<div id="action_column">
<ul>
		<li><!--如果外板order_items的个数为零的话，就让内板诊断的按钮失效-->
			<% if @order.num_of_out_order_items == 0%>
				<%= submit_tag "内板診断へ", :id => "submit", :disabled => true%>
			<%else%>
				<%= submit_tag "内板診断へ", :id => "submit",:onclick => "return verify();"%>
			<%end%>
			<%end%>
		</li>
		<li>
			<%= button_to "  次の部位へ  ", :action => :next_position %>
		</li>
		<li>
			<%= button_to "  診断終了  ", :action => :termination %>
		</li>
</ul>
</div>
<table border="1" id="order_item">
<%= render(:partial => "order_items", :locals => {:order_items => @order_items,
												  :order => @order,
                                                  :time_index_of_uninstall => @time_index_of_uninstall,
                                                  :time_index_of_putty => @time_index_of_putty,
                                                  :time_index_of_surface => @time_index_of_surface, 
                                                  :time_index_of_paint => @time_index_of_paint})%>
</table>

<%= observe_form :frame_select,
				  :frequency => 0.2,
                  :url => {:controller => :internal_damage_judge, :action => :recalculate_on_change }%>

<script type="text/javascript">
	function verify() {
		frame_object = document.getElementsByName("frame");
		var noSelect = true; 
		for(var i=0;i<frame_object.length;i++) {
			if(frame_object[i].checked == true) {
				noSelect = false;
				break;
			}
		}
		if(noSelect) {
			alert("修正機使用するかどうかを選択してください");
			return false;
		}
	}
</script>


